from datetime import datetime


def datetime2string(d_time=None, _format="%Y-%m-%d %H:%M:%S"):
    if not d_time:
        d_time = datetime.now()
    return d_time.strftime(_format)
